# -*- encoding=utf-8 -*-

from froModuleDrivers.homeDeviceDriver import HomeDeviceDriver
from froModuleDrivers.gateway import GatewayDriver
from froModuleDrivers.nioManager import NioManager
import time

driver_home = HomeDeviceDriver("192.168.1.100", 4001)
driver_home_1 = GatewayDriver("192.168.1.101", 4001)
manager = NioManager(driver_home, driver_home_1)
manager.run()

driver_home_1.playAudioPlayer(4,1,100) # 打开4号节点的蜂鸣器
time.sleep(2)

driver_home_1.stopAudioPlayer(4) # 关闭4号节点的蜂鸣器
time.sleep(2)

driver_home.openDoor(2)
time.sleep(1)
driver_home.openRoomFan(3)
time.sleep(1)
driver_home.openCurtain(1)
time.sleep(1)

driver_home.openColorfulLight(5,1,60)
time.sleep(1)
driver_home.openColorfulLight(5,2,50)
time.sleep(1)
driver_home.openColorfulLight(5,3,40)
time.sleep(1)
driver_home.openColorfulLight(5,4,30)
time.sleep(1)
driver_home.openColorfulLight(5,5,20)
time.sleep(1)
driver_home.openColorfulLight(5,6,10)
time.sleep(1)
driver_home.openColorfulLight(5,0,60)
time.sleep(1)

driver_home.closeDoor(2)
time.sleep(1)
driver_home.closeRoomFan(3)
time.sleep(1)
driver_home.closeCurtain(1)
time.sleep(1)

manager.shutdownGracefully()



